<template>
	<el-dialog :title="titleMap[mode]" v-model="visible" width="85%" destroy-on-close @closed="$emit('closed')" align-center>
        <el-row :gutter="1">
            <el-col :span="16">
                <scTable ref="table" :data="tableData" stripe remoteSort remoteFilter border   height="650">
                    <el-table-column type="index" label="序号" align="center" width="50"></el-table-column>
                    <el-table-column label="日期" prop="date" align="center">
                        <template #default="{row}">
                            <div v-if="row.type==2" style="color:red">{{row.date}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column label="出入库" prop="ware_name" align="center">
                        <template #default="{row}">
                            <div v-if="row.type==1">入库</div>
                            <div v-else style="color:red">出库</div>
                        </template>
                    </el-table-column>
                    <!-- <el-table-column label="送货单号" prop="stock" align="center">
                        <template #default="{row}">
                            <div v-if="row.type==2" style="color:red">{{row.stock}}</div>
                        </template>
                    </el-table-column> -->
                    <el-table-column label="单号" prop="order_no" align="center">
                        <template #default="{row}">
                            <div v-if="row.type==2" style="color:red">{{row.order_no}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column label="缸号" prop="batch_no" align="center">
                        <template #default="{row}">
                            <div v-if="row.type==2" style="color:red">{{row.batch_no}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column label="数量" prop="stock" align="center">
                        <template #default="{row}">
                            <div v-if="row.type==2" style="color:red">{{row.stock}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column label="单价" prop="price" align="center">
                        <template #default="{row}">
                            <div v-if="row.type==2" style="color:red">{{row.price}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column label="金额" prop="amount" align="center">
                        <template #default="{row}">
                            <div v-if="row.type==2" style="color:red">{{row.amount}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column label="实时库存" prop="after" align="center">
                        <template #default="{row}">
                            <div v-if="row.type==2" style="color:red">{{row.after}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column label="备注" prop="remark" align="center">
                        <template #default="{row}">
                            <div v-if="row.type==2" style="color:red">{{row.remark}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column label="批次号" prop="batch_number" align="center">
                        <template #default="{row}">
                            <div v-if="row.type==2" style="color:red">{{row.batch_number}}</div>
                        </template>
                    </el-table-column>
                </scTable>
            </el-col>
            <el-col :span="1"></el-col>
            <el-col :span="6">
                <scTable ref="table" :data="tableDatas" stripe remoteSort remoteFilter border hideDo hidePagination height="620" show-summary>
                    <el-table-column label="月份" prop="date" align="center"></el-table-column>
                    <el-table-column label="入库" prop="in_num" align="center"></el-table-column>
                    <el-table-column label="出库" prop="out_num" align="center"></el-table-column>
                </scTable>
            </el-col>
        </el-row>
		<template #footer>
			<el-button @click="visible = false">取 消</el-button>
		</template>
	</el-dialog>
</template>

<script>
export default {
    // props:{
    //     query: { type: String, default: "" },
    // },
	emits: ['success', 'closed'],
	data() {
		return {
			mode: "add",
			titleMap: {
				add: '物料出入库明细表',
				edit: '编辑仓库',
				show: '查看'
			},
			visible: false,
			isSaveing: false,
            tableData:[],
            tableDatas:[],
            apiObj: this.$API.inventory.batchStockDetail,
		}
	},
	mounted() {
	},
	methods: {
		//显示
		open(mode = 'add') {
			this.mode = mode;
			this.visible = true;
			return this
		},
		//表单注入数据
		async setData(data) {
            var res = await this.$API.inventory.batchStockDetail.get({id:data.id});
            this.tableData = res.data.list
            this.tableDatas = res.data.month_list
		}
	}
}
</script>

<style></style>
